package com.naiterui.ehp.bs.patient.domain;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * 家庭成员

 * @since 2.18
 */
@Entity
@Table(name = "patient_family")
public class PatientFamily implements Serializable {

    /**
     * 字段或域定义：<code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 845084827072132890L;

    /**
     * 是否可见：1：私密，2：可见
     */
    public static int VISIBLE_DEFAULT = 1;
    public static int VISIBLE_YES = 2;

    private Long id; // 主键
    private Long patientId; // 患者ID
    private Integer relation;   // 和本人关系:0：父亲；1：母亲；2：兄弟姐妹；3：子女；4：丈夫；5：妻子；6：本人；7：其他家庭成员
    private String name;    // 家庭成员性别:0女1男
    private Integer gender;
    private Date birth; // 家庭成员出生日期
    private String phone;   // 手机号
    private String idCard;  // 身份证号

    private Integer visible; //是否可见：1：私密，2：可见

    private Date createdAt; // 创建时间

    private String createdBy; // 创建人

    private String changedBy; // 修改人

    private Date changedAt; // 修改时间

    private Integer version; // 版本

    @Id
    @Column(name = "id", unique = true, nullable = false)
    @GeneratedValue(strategy = IDENTITY)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "patient_id")
    public Long getPatientId() {
        return patientId;
    }

    public void setPatientId(Long patientId) {
        this.patientId = patientId;
    }

    @Column(name = "relation")
    public Integer getRelation() {
        return relation;
    }

    @Column(name = "name")
    public String getName() {
        return name;
    }

    @Column(name = "gender")
    public Integer getGender() {
        return gender;
    }

    @Column(name = "birth")
    public Date getBirth() {
        return birth;
    }

    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }

    @Column(name = "id_card")
    public String getIdCard() {
        return idCard;
    }

    public void setRelation(Integer relation) {
        this.relation = relation;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    @Column(name = "created_at")
    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    @Column(name = "created_by")
    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @Column(name = "changed_by")
    public String getChangedBy() {
        return changedBy;
    }

    public void setChangedBy(String changedBy) {
        this.changedBy = changedBy;
    }

    @Column(name = "changed_at")
    public Date getChangedAt() {
        return changedAt;
    }

    public void setChangedAt(Date changedAt) {
        this.changedAt = changedAt;
    }

    @Version
    @Column(name = "version")
    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Integer getVisible() {
        return visible;
    }

    public void setVisible(Integer visible) {
        this.visible = visible;
    }

    @Override
    public String toString() {
        return "PatientFamily [id=" + id + ", patientId=" + patientId + ", relation=" + relation + ", name=" + name + ", gender=" + gender
                + ", birth=" + birth + ", phone=" + phone + ", idCard=" + idCard + ", createdAt=" + createdAt + ", createdBy=" + createdBy
                + ", changedBy=" + changedBy + ", changedAt=" + changedAt + "]";
    }

}
